Repository navigation
fix: replace salt auto-write with guided paste + docs (1.0.1) - #13
Conversation
The "Fix WordPress salts" wizard previously rewrote wp-config.php directly (atomic temp-swap, plus a 1.0.1-era in-place fallback). Rewriting the site's master config file is too high blast-radius for a login plugin: a mid-write failure could fatal the whole site with no backup. Remove the auto-write entirely and keep the safe parts. - Installer: drop apply_salt_fix, salt_autofix_available, rewrite_salt_defines, defines_present and fetch_salts_from_api. Salts are now generated locally with random_bytes only (never fetched over the network) and shown for the admin to paste. The notice, paste block and recheck remain. - Detection is now runtime-authoritative: runtime_salts_weak() reads the loaded constants and check_salts() runs on admin_init, so environment/managed hosts (Bedrock, WP Engine, Pantheon) are no longer falsely flagged and the notice self-heals once the salts are strong. - Branded-login gate softened from a hard block to an informed-consent warning: a known salt cannot forge a MagicAuth link/code (the verifier plaintext is random 256-bit) and the toggle is never re-checked at runtime, so the block only locked correctly-configured sites out of the feature. - Notice, wizard and the toggle tooltip link to a new guide at docs.ettic.nl/docs/magicauth/weak-salts. - Tests updated for the removed methods (logic re-validated); version -> 1.0.1; readme changelog and FAQ entry added; decisions.md updated. Supersedes #12.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR shifts the WordPress salts security fix workflow from automatic wp-config.php rewriting to a runtime-first verification approach with advisory notices and manual copy/paste. Detection now validates the actual WordPress constants at each admin load, settings forms offer warnings instead of blocking, and the wizard always displays locally-generated salts for manual insertion. ChangesWordPress Salts Advisory & Manual Fix
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
What
Removes the salt auto-write (the code that rewrote
wp-config.phpfor the user) and replaces it with a guided copy-and-paste flow plus a dedicated documentation guide. Ships as 1.0.1 and supersedes #12.Why
The wizard rewrote the site's master config file. The shipped 1.0.0 path used an atomic temp-swap; #12 proposed an in-place
put_contentsfallback for locked-directory hosts. A security review (and a follow-up advisory council) concluded that an auth plugin rewritingwp-config.phpis the wrong risk/reward for a single-site v1: a mid-write failure can truncate the file and fatal the whole site, with no backup and no rollback. The manual paste path already existed and is the safe contract.The review also found two adjacent issues, both fixed here:
api.wordpress.orgwith no length floor (a tampered response could write weak salts). Now generated locally withrandom_bytesonly.Changes
apply_salt_fix,salt_autofix_available,rewrite_salt_defines,defines_present,fetch_salts_from_api. Keep detection, the admin notice, the paste block, and recheck.salt_values()generates withrandom_bytes; nothing is sent over the network.runtime_salts_weak()reads the loaded constants;check_salts()runs onadmin_initand self-heals the notice. Env/managed hosts are no longer falsely flagged.replace_defaultis allowed with a non-blocking warning instead of a hard block (a known salt can't forge a MagicAuth link/code, and the toggle is never re-checked at runtime).docs.ettic.nl/docs/magicauth/weak-salts(added in the docs repo).1.0.1; readme changelog + FAQ;_dev/decisions.mdupdated.Verification
php -lclean on all changed files; JSnode --checkclean.Installer.php. PHPUnit/PHPStan can't run on this local PHP 8.5 box (they bail silently); CI runs them on a supported PHP.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Improvements
Documentation